package com.aiguigu.JUC;

import java.util.concurrent.*;

public class TestJuc {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        Callable callable;
        FutureTask<String> futureTask = new FutureTask<>(()->{
            System.out.println("这是callable");
            return "hello callable.....";
        });

        // new MyThread().start();
        new Thread(futureTask).start();
        System.out.println(futureTask.get());
        System.out.println("这是main方法"+Thread.currentThread().getName());
    }
}

class Myrunable implements Runnable{
    @Override
    public void run() {
        System.out.println("这是一个子任务"+Thread.currentThread().getName());
    }
}

class MyThread extends Thread{
    @Override
    public void run() {
        System.out.println("这是一个子任务"+Thread.currentThread().getName());
    }
}

class Pool{
    ExecutorService threads = Executors.newFixedThreadPool(5);
    public void  tes(){
        try {
             threads.execute(()->{

             });
        }catch (Exception e){

        }finally {

        }
    }

}